import React from 'react';
import {
  View,
  Text,
  TouchableOpacity,
  TouchableHighlight,
} from 'react-native';


import TImage from '../../components/TImage';
import SizeUtils from '../../common/SizeUtils';
import CommonStyles from '../../common/CommonStyles';
import Constants from '../../common/Constants';
import Config from '../../config';
import CommonDataListView from '../common/CommonDataListView';
import QuanziRequestQuanziAllListAction from '../../actions/quanzi/QuanziRequestQuanziAllListAction';
import LoginCheckIsUserAction from '../../actions/login/LoginCheckIsUserAction';
import CommonListPage from '../common/CommonListPage';
import QuanziItemView from './QuanziItemView';

export default class QuanziAllListPage extends CommonListPage {
  constructor(props) {
    super(props);
    this._dataKey = "board_id";
  }


  _onRenderItem(data, index) {
    return (<QuanziItemView data={data} />);
  }

  _onPressItem(data) {
    this.gotoPage(Config.pages.quanzi_content,data);
  }

  _getListViewStyle() {
    return {
        width:SizeUtils.getWindowSize().width,
        height:(SizeUtils.getWindowSize().height - Config.paddingTop - SizeUtils.translateDesignHeightToCode(40)),
        backgroundColor:"#ffffff00"};
  }

  _requestData(page,listView) {
    new LoginCheckIsUserAction().call(this, {content:"你是游客身份，不能使用此功能"} ,
      (result) => {result && Config.pages.user_ziliao});

    new QuanziRequestQuanziAllListAction().call(listView, {page:page})
  }

  _renderNavigationBarRightButtonContent() {
    return (
      <View>
        <TImage source={require("../../../resource/images/workhard/search.png")}
          style={{width:34, height:34}}/>
      </View>
    )
  }

  _onPressNavigationBarRightBtn() {
    this.gotoPage(Config.pages.quanzi_search);
  }
}
